#coding=utf-8
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QMenuBar, QAction, qApp
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QCoreApplication

class Example3(QMainWindow):

    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        # exitAction = QAction(QIcon('exit.png'), '退出吧宝宝', self)
        exitAction = QAction('退出吧宝宝', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.triggered.connect(qApp.quit)

        self.toolbar = self.addToolBar('Exit123')
        self.toolbar.addAction(exitAction)
        self.toolbar.addAction(QIcon('exit.png'), '翻滚')

        self.setGeometry(300, 300, 450, 450)
        self.setWindowTitle('QMainWindow的ToolBar')
        self.show()
        pass

def main3():
    app = QApplication(sys.argv)
    example = Example3()
    sys.exit(app.exec_())
    pass

if __name__ == '__main__':
    main3()
